-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Porting throwError function for proper error handling of parseUrl #52
fix: Porting throwError function for proper error handling of parseUrl #52
Conversation
index.js
Outdated
@@ -346,6 +359,16 @@ class GitlabScm extends Scm { | |||
token | |||
}) | |||
.then(response => { | |||
if (response.statusCode === 404) { | |||
throwError(`Cannot find repository ${checkoutUrl}`, response.statusCode); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the statusCode is 404, error object is thrown with statusCode as result of runCommand, so no need to add this line.
index.js
Outdated
`STATUS CODE ${response.statusCode}: ${JSON.stringify(response.body)}`, | ||
response.statusCode | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be a situation that should not be error on 2xx, so I remove this block.
Could you test that the Lines 260 to 262 in 05c4498
|
Thank you. I added a test. |
🎉 This PR is included in version 2.9.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Context
Port the throwError function from scm-github so that the error handling of parseUrl can be done normally.
https://github.com/screwdriver-cd/scm-github/blob/e554b40619b8530d0eadc9ac02f35e3826900ff0/index.js#L57
Objective
Error handling of parseUrl is successful
References
screwdriver-cd/screwdriver#2674
License
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.